#pragma once
#include "CControl.h"
#include "CValue.h"

class CTransitionCollection;

class CContentControl :
	public CControl
{

protected: 
	CContentControl(CCoreServices * pCore);
	virtual ~CContentControl();
public: 
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;
protected: 
	virtual XBOOL CanEnterImpl(CDependencyObject * pNamescopeOwner);
	virtual HRESULT EnterImpl(CDependencyObject * pNamescopeOwner, struct EnterParams params);
	virtual HRESULT LeaveImpl(CDependencyObject * pNamescopeOwner, struct LeaveParams params);
public: 
	static HRESULT Content(struct Xcp_IDependencyObject * pObject, XUINT32 cArgs, CValue * pArgs, CValue * pResult);
	virtual HRESULT SetValue(CDependencyProperty * pdp, CValue * pValue);
	virtual HRESULT ClearValue(CDependencyProperty * pdp);
	static HRESULT CreateDefaultVisuals(CContentControl * pParent, CDependencyObject * pContent, CXString * pstrBindingPath);
	static HRESULT CreateDefaultTemplate(CControlTemplate * * ppTemplate, CDependencyObject * pTemplatedParent, CXString * pstrBindingPath);
	void SetContentIsLogical(XUINT8 flag);
	XUINT8 IsContentLogical();
	void SetContentIsTemplateboundManaged(XUINT32 bValue);
	XUINT32 IsContentTemplateboundManaged();
	HRESULT DeferredContentRemovalLogic(CDependencyObject * pTarget);
	XUINT32 HasRootScrollViewerApplyTemplate();
	XUINT32 HasRootScrollViewerProcessWindowSizeChanged();
	XUINT32 HasRootScrollViewerRequestedInputPaneShowing();
	void SetRootScrollViewerSettingApplyTemplate(XUINT32 bValue);
	void SetRootScrollViewerSettingWindowSizeChanged(XUINT32 bValue);
	void SetRootScrollViewerSettingRequestedInputPaneShowing(XUINT32 bValue);
	virtual HRESULT ShouldBringIntoViewOnKeyboardFocus(XUINT32 * pShouldShouldBringIntoView);
protected: 
	virtual HRESULT ApplyTemplate(XUINT32 & fAddedVisuals);
	virtual XUINT32 CompareForCircularReference(CFrameworkElement * pTreeChild);
private: 
	HRESULT Invalidate(XUINT32 bClearChildren);
	XUINT8 m_bContentIsLogical;
	XUINT32 m_bContentIsTemplateboundManaged;
public: 
	CTransitionCollection * m_pContentTransitions;
	XUINT8 m_bInOnApplyTemplate;
	CValue m_content;
	CDataTemplate * m_pContentTemplate;
	CDataTemplate * m_pSelectedContentTemplate;
	XFLOAT m_rootScrollViewerOriginalHeight;
	XUINT8 m_rootScrollViewerSettings;
};